home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16942 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  64 lines

  1. Path: tech.cftnet.com!usenet
  2. From: Marc Donovan <ams@cftnet.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Borland OWL SetupWindow function
  5. Date: Thu, 11 Apr 1996 22:57:11 GMT
  6. Organization: CFTnet
  7. Message-ID: <4kk2ip$mv8@tech.cftnet.com>
  8. References: <DpMG63.JB9@grog.allware.com>
  9. NNTP-Posting-Host: ppp248_4.cftnet.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. nathan@allware.com (Nathan Tocus) wrote:
  13.  
  14. >How do you pass arguments to the SetupWindow function in OWL 2.5.  All
  15. >the examples in the books I've read use SetupWindow to initialize
  16. >controls but they never pass it any arguments.  Since this function is
  17. >called automatically when a window element is created and not
  18. >explicitly called from your program, it appears that you can't pass it
  19. >anything.  The only way I have been able to make variables available
  20. >to SetupWindow is to use global variables, which I would rather avoid.
  21.  
  22.  
  23. Use member functions and member variables.  You should inherit your
  24. class from TWindow (or TDialog, or whatever), and then use your own
  25. added functionality.
  26.  
  27. class MyWindow ; public TWindow {
  28. public:
  29. virtual void SetupWindow ();  // this gets called instead of
  30.         //TWindow::SetupWindow
  31.  
  32.     void MyFunction ();
  33.     int MyVariable;
  34.     };
  35.  
  36.  
  37. void MyWindow::SetupWindow () {
  38.     TWindow::SetupWindow 
  39.     //^^^^^^^^^^^^^^^^^^
  40.     // This is VERY important and is 
  41.     // a major cause of errors.
  42.  
  43.     MyFunction ();
  44.     // ^^^^^^
  45.     // this can access / modify anything you want
  46.     
  47.     .
  48.     .
  49.     .
  50.     
  51.     }
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. ****************************************************************
  59.  Marc Donovan                   Commercial Computer Systems Inc.
  60. ams@cftnet.com                         St. Petersburg, FL
  61. (813) 579-0000                              TANSTAAFL
  62. ****************************************************************
  63.  
  64.